﻿using System;
using System.Net;
using System.Net.Http;
using System.Web.Http;

using Sustainalytics.ESGRatings.BusinessLogic.Computing;
using Sustainalytics.ESGRatings.Computing.Entities;

namespace Sustainalytics.ESGComputing.Service.Controllers
{
    [RoutePrefix("api/v1/dataprovisioning/esgsets")]
    public class EsgRawScoresController : ApiController
    {
        private readonly ComputationEngine computationEngine;

        public EsgRawScoresController(ComputationEngine computationEngine)
        {
            this.computationEngine = computationEngine;
        }

        [Route("{setId}/rawscores")]
        public HttpResponseMessage Post(Guid setId, CompanyScores[] data)
        {
            computationEngine.SetIndicatorsData(setId, data);

            return Request.CreateResponse(HttpStatusCode.Created);
        }
    }
}